package com.vodone.v1pin.userInfo.delegate
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.model.MainModelLocator;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	
	import mx.rpc.http.mxml.HTTPService;
	
	public class CouponDelegate
	{
		public static function getRedCouponCanUseList( resultHandler:Function , money:Number, prodouctList:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getRedCardService;
			var params:Object = {
				userId : MainModelLocator.getInstance().userLoginVO.userId,
				money : money,
				prodouctList : prodouctList
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		
		public static function getCouponList( resultHandler:Function , type:String = "" , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getCouponService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				type : type
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function activeCoupon( resultHandler:Function , couponCode:String , couponPwd:String , prodouctList:String = "", activeType:String="1", orderTotal:Number = -1 , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().activeCouponService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				couponCode : couponCode,
				orderTotal : orderTotal,
				couponPwd : couponPwd,
				prodouctList : prodouctList,
				activeType : activeType
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		public static function giftCardSearch( resultHandler:Function , couponCode:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().giftCardSearchService;
			var params:Object = {
					couponCode : couponCode
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function giftCardVerify( resultHandler:Function , couponCode:String ,couponPwd:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().giftCardVerifyService;
			var params:Object = {
				couponCode : couponCode,
				couponPwd :couponPwd
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		public static function getCouponProductList(resultHandler:Function , productId:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getCouponProduct;
			var params:Object = {
				itemList : productId
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		public static function getCouponTypesList(resultHandler:Function , typeId:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getCouponTypes;
			var params:Object = {
				itemList : typeId
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
	}
}